// pages/me/me.js
const util = require('../../utils/util');
const app = getApp();
const $api = require('../..//utils/api').API;
import Toast from '@vant/weapp/toast/toast';
import Notify from '@vant/weapp/notify/notify';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    password: '',
    username: '',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  // 获取用户名
  getUsername(e) {
    this.setData({
      username: e.detail.value
    })
  },

  // 获取密码
  getPassword(e) {
    this.setData({
      password: e.detail.value
    })
  },

  // 登陆操作
  loginClick: function (e) {
    console.log(this.data);
    $api.confirm({username:this.data.username,password:this.data.password}).then(res => {
      console.log(res);
      if(res.resultCode == 200) {
        Notify('认证成功');
        wx.setStorageSync('isConfirm', true);
        setTimeout(() => {
           wx.navigateBack(-1);
        }, 1000);
       
      }
    })
  }
})